
<form class="pageForm"
	onsubmit="return dialogCallback(this,selectTrees)" style="height: 100%;">
	<div layoutH="37" style="overflow: auto;">
		<div code="if('{sign}') return 'style=display:none;'">
			<select name="category" onchange="selectCategorySign(this)"
				action="/management/sign" opText="${value}" opValue="${sign}"
				defSelValue="{sign}">
			</select>
		</div>
		<div class="templet">
			<li>
				<a>${name}</a>
			</li>
		</div>
		<ul class="tree treeFolder {type} expand" oncheck="treeChecked"
			action="/category/{category_id}/children" entity="{entity}"
			category_id="{category_id}"></ul>
	</div>
	<div class="formBar">
		<ul>
			<li>
				<div class="buttonActive">
					<div class="buttonContent">
						<button type="submit" class="ok">
							确定
						</button>
					</div>
				</div>
			</li>
			<li>
				<div class="button">
					<div class="buttonContent">
						<button type="button" class="close">
							取消
						</button>
					</div>
				</div>
			</li>
		</ul>
	</div>
</form>
<script type="text/javascript">
	function selectCategorySign(sel){
		var $sel = $(sel);
		var data = $(sel.options[sel.selectedIndex]).data("data");
		var ul = $sel.parent().parent().find("ul.tree");
		ul.attr("entity",data.entity).attr("category_id","0");
		ul.reload();
	}
	function treeChecked(item){
		alert(item)
	}
	function selectTrees(form){
		var items=[];
		var $tree = $("ul.tree",form);
		if($tree.hasClass("treeCheck")){
			var $boxs=$(":checkbox[checked=true]",$tree);
			$boxs.each(function(){
				items[items.length] = $(this).parents("li").data("item");
			});
		}else if($tree.hasClass("treeRadio")){
			var $radio=$(":radio[checked=true]",$tree);
			items = $radio.parents("li").data("item");
		}
		return items;
		//alert(items);
	}
</script>
